/*
 * Copyright (c) 2007-2021 西安交通信息投资营运有限公司 版权所有
 */

package com.xci.xajtfb.bus.api;

import com.github.lvyanyang.annotation.Authorize;
import com.github.lvyanyang.annotation.RequestJson;
import com.github.lvyanyang.core.BaseController;
import com.github.lvyanyang.core.BoolResult;
import com.github.lvyanyang.core.Const;
import com.github.lvyanyang.model.IdBody;
import com.xci.xajtfb.bus.entity.RealBus;
import com.xci.xajtfb.bus.service.BusIntelligentAdjustableService;
import com.xci.xajtfb.bus.service.TbBusLineService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiOperationSupport;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * 智能调接口
 * @author 马星俊 maxingjun@xci96716.com
 * @since 2021-03-08 16:31:56
 */
@Api(tags = "智能调接口")
@Authorize
@RestController
@RequestMapping(value = "/api/bus/intelligentAdjustable", produces = Const.PROJSON)
public class BusIntelligentAdjustableApiController extends BaseController {
    /** 智能调服务 */
    @Resource private BusIntelligentAdjustableService busIntelligentAdjustableService;
    /** 智能调服务 */
    @Resource private TbBusLineService tbBusLineService;

    @ApiOperationSupport(order = 1)
    @ApiOperation(value = "根据名称查询线路列表")
    @PostMapping("/getBusLineByName")
    public BoolResult<List<Map<String, Object>>> getBusLineByName(String routeId) {
        return BoolResult.success(tbBusLineService.selectByName(routeId));
    }

    @ApiOperationSupport(order = 2)
    @ApiOperation(value = "通过线路标识查询实时公交信息")
    //@Authorize(code = "bus.busIntervalTable.select")
    @PostMapping("/getRealBusLine")
    public BoolResult<RealBus> getRealBusLine(@RequestJson String routeId) {
        return BoolResult.success(busIntelligentAdjustableService.getRealBusLine(routeId));
    }

}